package acm.蓝桥3;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class 傻逼数 {
    static int l, r = 0;
    static List<Integer> list = new ArrayList<>(r);

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        l = sc.nextInt();
        r = sc.nextInt();
        list.add(0);
        for (int i = 1; i < r; i += 2) {
            list.add(i);
        }
        int cnt = 2;
        while (true) {
            int size = list.size();
            Integer mod = list.get(cnt++);
            if (mod > size) {
                break;
            }
            List<Integer> temp = new ArrayList<>(size);
            temp.add(0);
            for (int i = 1; i < size; i++) {
                if (i % mod != 0) {
                    temp.add(list.get(i));
                }
            }
            list = temp;
        }
        int size = list.size();
        int i = find(0, size - 1, l);
        System.out.println(size-i);
    }

    public static int find(int l, int r, int n) {
        while (l <= r) {
            int mid = (l + r) / 2;
            if (list.get(mid) > n) {
                r = mid - 1;
            } else {
                l = mid + 1;
            }
        }
        if (list.get(r) > n)
            return r;
        return l;
    }
}
